ZLIB v1.1 by Joe Wingbermuehle 05-16-1998

>If you would like to have your own lib, talk to me. I don't want a
flood of libs like there are for TI-92 Fargo so I will group libs that
I find useful into a library file.

>These routines may change, so don't get too dependent on them!

>This is the first library file created for SOS.
It contains the following procedures:
	-beep (lib0)
	-sprite (lib1)
	-rand (lib2)
	-getbit (lib3)
	-detect (lib4)
	-sleep (lib5)
	-decomp (lib6)
	-delete (lib7)
	-contup	(lib8)
	-contdn (lib9)
	-contst (libA)
	-invert (libB)
	-getpix (libC)
	-hiscr (libD)
	-E and F are not yet defined

>Although I have tested most of these routines, there still may be
bugs in them.  Let me know if you think you found one!
Each library can contain up to 16 routines.  If two versions of a
library exist and one doesn't contain as many routines as the other,
the library will simply return to the program it was called from if
a nonexistant routine is called!

>Descriptions of the procedures:
* Beep (lib0)
Makes a very short tone through the IO port.
It is meant to make sounds for during game play.
Input:	b=duration
	c=tone (experiment to find the best values)
Output:	sound is produced
Registers destroyed: af bc e

* Sprite (lib 1)
Displays an 8 pixel wide, 1-64 pixel high sprite (xor).
Input:	b=hight of sprite
	l=y coordinate
	a=x coordinate
	ix->sprite
Output:	sprite is printed to the graph buffer
Registers destroyed: af bc de hl

* Rand (lib 2)
Generates an 8-bit random number.
Input:	b=upper bound
Output:	a=random number between 0 and b-1.
Registers destroyed: af bc

* Getbit (lib 3)
Gets the bit for plotting a pixel etc.
Input:	a=coordinate (x if plotting)
	hl=start location
Output:	a=holds bit (e.g. %00001000)
	hl=location to be plotted (hl+a\8)
	b=0
	c=a\8
All register behavior has been described.

* Detect (lib 4)
Detect a program (var type 6) on the symbol table.
Input:	hl=place to begin looking ( (vat) if first time etc)
	ix->String to check for in a program (0 terminated)
Output:	de=place stopped
	hl->program data (after the string)
	z=0 if found, z=1 if not found
Registers destroyed: af bc de hl

* Sleep (lib 5)
Shut down the calculator until the user presses [ON].
Input:	nothing
Output:	calculator shuts down
Registers destroyed: af

* Decomp (lib 6)
Decompress data (Joe's compression scheme)
Input:	hl->compressed data
	de->place to load data after decompression
	b=length of compressed data
	c=compression factor (1, 3, or 15 - 1=8x compression etc)
Output:	Data is decompressed and stored at de
	hl->next byte of compressed data.
	de->de+(b*{8,4,2})
Registers destroyed: af bc de hl

* Delete (lib 7)
Delete program and return to SOS
Input:	hl->name of program
Output:	program is deleted (if found)
	SOS is restarted
Who cares what registers are destroyed?!?!
NOTE:  JP to this routine DO NOT CALL IT!

* Contup (lib 8)
Turn up the contrast
Input: nothing!
Output: contrast is turned up (if possible)
	a=contrast level
Registers destroyed: af

* Contdn (lib 9)
Turn down the contrast
Input: nothing!
Output: contrast is turned down (if possible)
	a=contrast level
Registers destroyed: af

* Contst (lib A)
Set the contrast
Input:	a=contrast (must be 0-63)
Output:	contrast is set
	a=contrast level (not the same as the input)
Registers destroyed: af

* Invert (lib B)
Inverts the screen
Input:	nothing
Output:	screen is totally inverted (including text flags)
Registers destroyed: af bc hl

* Getpix (lib C)
Get byte/bit for a pixel
Input:	e=y coordinate
	a=x coordinate
Output:	a holds bit of pixel
	hl->byte of pixel on the graph buffer
	(notice the output is the same as for getbit)
Registers destroyed: af bc de hl

* Hiscr (lib D)
Test/Sets the high score
Input:	de=previous high score
	hl=current score
Output:	hl=high score
	z=1 (a=0) if new high score, z=0 (a=1) if not
Registers destroyed: af de hl
